<?php
/**
 * Created by PhpStorm.
 * User: linux
 * Date: 31/01/2018
 * Time: 10:52 AM
 */

namespace App\Advice;


use Go\Aop\Aspect;
use Go\Aop\Intercept\MethodInvocation;
use Go\Lang\Annotation\Around;

class AroundAspect implements Aspect
{
    /**
     * @Around("execution(public App\Example\Example2->testAround(*))")
     */
    public function arroudAdvice(MethodInvocation $invocation)
    {
        // 可以利用AOP开发装饰器
        echo 'Do sth' . PHP_EOL;
        // 执行原函数过程
        $invocation->proceed();
        echo 'D sth' . PHP_EOL;
        // 改变原来
        return 'change res';
    }

}